import { create } from 'zustand';
import { persist } from 'zustand/middleware';

const LoginStore = create(
    persist(
        (set) => ({
            token:'',
            userInfo:{},
            setUserInfo:(userInfo)=>{
                set((state)=>({userInfo:state.userInfo=userInfo}))
            },
            setToken:(tokenString)=>{
                set((state)=>({token:state.token=tokenString}))
            }
        }),
        { name: 'token' }
    )
);

export default LoginStore;